/*
 * Copyright 2010 Alessandro Bellucci
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.soupframework.gwt.designerpanel.client.interaction;

import org.soupframework.gwt.designerpanel.client.DesignerPanel;

public class DesignerPanelInteractionHandlerBase<T> implements DesignerPanelInteractionHandler<T> {

	/**
	 * The {@link DesignerPanel} associated with this handler
	 */
	protected DesignerPanel<T> designerPanel;

	/**
	 * {@link InteractionMode} with the {@link DesignerPanel}
	 */
	protected InteractionMode interactionMode = InteractionMode.SELECT;

	/**
	 * Handler for the addition of new widgets to the {@link DesignerPanel}.
	 */
	protected NewObjectsHandler<T> newWidgetsHandler;

	public DesignerPanelInteractionHandlerBase(){
	}

	@Override
	public void registerToDesignerPanel(DesignerPanel<T> designerPanel){
		assert this.designerPanel == null : "DesignerPanel already set";
		this.designerPanel = designerPanel;
	}

	@Override
	public InteractionMode getInteractionMode() {
		return interactionMode;
	}

	@Override
	public void setInteractionMode(InteractionMode mouseInteractionMode) {
		this.interactionMode = mouseInteractionMode;
	}

	@Override
	public NewObjectsHandler<T> getNewWidgetsHandler() {
		return newWidgetsHandler;
	}

	@Override
	public void setNewWidgetsHandler(NewObjectsHandler<T> newWidgetsHandler) {
		this.newWidgetsHandler = newWidgetsHandler;
	}
}
